<include file="public@header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Nav/index')}">菜单列表</a></li>
        <li class="active"><a href="{:url('Nav/edit')}">编辑菜单</a></li>
    </ul>

    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Nav/editPost')}" onsubmit="return submitForm(this);">

    <div class="form-group">
            <label for="input-parent_id" class="col-sm-2 control-label"><span class="form-required">*</span>父级菜单</label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control" name="parent_id" id="input-parent_id">
                    <option value="0">作为一级菜单</option>
                    {$all_nav}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>菜单名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name" value="{$nav.name}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-app" class="col-sm-2 control-label"><span class="form-required">*</span>跳转链接</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-app" name="url" value="{$nav.url}">
            </div>
        </div>
        <!--编辑状态-->
        <div class="form-group">
            <label for="input-app" class="col-sm-2 control-label"><span class="form-required">*</span>显示状态</label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" class="" name="status" value="1">{:lang('DISPLAY')}
                <input type="radio" class="" name="status" value="0">{:lang('HIDDEN')}
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
            </div>
        </div>
        <input type="hidden" name="id" value="{$nav.id}">
    </form>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script>
    function submitForm(form) {
        // 在表单提交前进行验证，这里可以检查表单是否合法等
        // ...

        // 提交表单
        form.submit();

        // 跳转到目标链接
        window.location.href = "{:url('nav/index')}";

        // 返回false以阻止表单进行默认的提交操作
        return false;
    }
</script>

</body>
</html>